﻿<Window x:Class="SlaktDataReader.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:local="clr-namespace:SlaktDataReader"
        Title="SläktData Edit" Height="680" Width="1000" Loaded="Window_Loaded" DataContext="{Binding RelativeSource={RelativeSource Self}}"
        Closing="Window_Closing" WindowStartupLocation="CenterScreen">
    <Window.Resources>

    </Window.Resources>
    <Grid Background="{DynamicResource BG1}">
        <Grid.RowDefinitions>
            <RowDefinition Height="30" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" Background="{DynamicResource DarkColor1}" >

        </Grid>
        <TabControl Grid.Row="1" BorderThickness="0" Style="{StaticResource mainTabControl}" >
            <TabItem Header="PLATSER" Style="{StaticResource LocationTabItem}">
                <Grid x:Name="grdLocations" Background="{StaticResource BG1}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50" />
                        <RowDefinition Height="*" />
                        <RowDefinition Height="150" />
                    </Grid.RowDefinitions>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        
                    </Grid>
                    <!--<TextBlock Text="{Binding ElementName=textBlock1, Path=Text, Converter={StaticResource SubLocationConverter1}, ConverterParameter=aa}" />-->


                    <Button Name="bLocationUp" Click="bLocationUp_Click" Height="20" Width="50" Margin="25,0" HorizontalAlignment="Left" 
                                Visibility="{Binding Path=UppButtonVisibility}">Upp
                    </Button>
                    <TextBlock Text="{Binding Path=CurrentLocationParent.LocationName}" Foreground="White" FontSize="28" Margin="105,0,50,0" 
                                   HorizontalAlignment="Left" FontWeight="Thin" FontFamily="Fonts/OpenSans-Light.ttf#Open Sans" />

                    <!--<ListView x:Name="lstLocations" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Path=CurrentLocations}"
                             MouseDoubleClick="lstLocations_MouseDoubleClick" Margin="20,10,0,10" Background="{StaticResource BG1}" Grid.Row="1"
                             SelectionChanged="lstLocations_SelectionChanged" BorderBrush="Transparent" BorderThickness="0" HorizontalContentAlignment="Stretch" >
                        <ListView.View>
                            <GridView>
                                <GridViewColumn Header="Kod" CellTemplate="{StaticResource LocationCodeData}" Width="80"/>
                                <GridViewColumn Header="Område" CellTemplate="{StaticResource LocationNameData}" Width="250"/>
                                <GridViewColumn Header="Aktiv" CellTemplate="{StaticResource LocationTimeData}" Width="120" />
                                <GridViewColumn Header="Underområden" CellTemplate="{StaticResource LocationSubAreaData}" />
                            </GridView>
                        </ListView.View>
                    </ListView>-->

                    <ListBox x:Name="lstLocations" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ItemsSource="{Binding Path=CurrentLocations}"
                             MouseDoubleClick="lstLocations_MouseDoubleClick" Margin="20,10,0,10" Background="{StaticResource BG1}" Grid.Row="1"
                             SelectionChanged="lstLocations_SelectionChanged" ItemTemplate="{DynamicResource LocationDataTemplate}" >
                        <ListBox.BorderBrush>
                            <SolidColorBrush />
                        </ListBox.BorderBrush>
                    </ListBox>
                    <WrapPanel Orientation="Horizontal" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="20,0" >
                        <Button Name="bAddLocation" Content="+" Style="{StaticResource AddButton}" Width="100" Height="25" Click="bAddLocation_Click" HorizontalAlignment="Center" VerticalAlignment="Center" />
                        <Button Name="bEditLocation" Content="Redigera" Width="100" Height="25" Click="bEditLocation_Click" Margin="6,0" />
                    </WrapPanel>


                    <Border Grid.Row="2" BorderThickness="0,3,0,0" BorderBrush="{DynamicResource Light3_33}">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="30" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="30" />
                                <RowDefinition Height="*" />
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="150" />
                                <ColumnDefinition />
                            </Grid.ColumnDefinitions>

                            <TextBlock Grid.Column="0" Grid.Row="0" Foreground="White" Text="Namn:" FontSize="16" 
                                   HorizontalAlignment="Right" Margin="10,0" VerticalAlignment="Center"/>
                            <TextBlock Grid.Column="1" Grid.Row="0" Foreground="{StaticResource Light1}" Text="{Binding ElementName=lstLocations, Path=SelectedItem.LocationName}"  
                                   FontWeight="Light" FontSize="18" TextTrimming="WordEllipsis" VerticalAlignment="Center" Margin="10,0" />

                            <TextBlock Grid.Column="0" Grid.Row="1" Foreground="White" Text="Kategori:" FontSize="16" HorizontalAlignment="Right" Margin="10,0"/>
                            <TextBlock Grid.Column="1" Grid.Row="1" Foreground="{StaticResource Light1}" Text="{Binding Path=CurLocationType}"  
                                   FontWeight="Light" FontSize="18" TextTrimming="WordEllipsis" VerticalAlignment="Center" Margin="10,0"/>

                            <TextBlock Grid.Column="0" Grid.Row="2" Foreground="White" Text="Böcker:" FontSize="16" HorizontalAlignment="Right" Margin="10,0" />
                            <!--<TextBlock Grid.Column="1" Grid.Row="2" Foreground="{StaticResource Light1}" Text="{Binding Path=LocationBookCount}" 
                                     FontWeight="Light" FontSize="18" TextTrimming="CharacterEllipsis" />-->


                            <ListBox ItemsSource="{Binding Path=LocationBooks}" Height="Auto" Foreground="White" FontFamily="Arial" 
                                     ItemTemplate="{DynamicResource BooksInArea}" Grid.Column="1" Grid.Row="2" Grid.RowSpan="2" Width="Auto" 
                                     Background="Transparent" BorderBrush="Transparent" Name="lstLocationBooks" 
                                     MouseDown="lstLocationBooks_MouseDown" MouseDoubleClick="lstLocationBooks_MouseDown" Margin="0,0,10,0">
                                <ItemsControl.ItemsPanel>
                                    <ItemsPanelTemplate>
                                        <WrapPanel IsItemsHost="True" Orientation="Horizontal"  />
                                    </ItemsPanelTemplate>
                                </ItemsControl.ItemsPanel>
                                <ListBox.Resources>
                                    <Style TargetType="ListBoxItem">
                                        <Setter Property="TextElement.FontSize" Value="12" />
                                        <Setter Property="Template">
                                            <Setter.Value>
                                                <ControlTemplate TargetType="ListBoxItem">
                                                    <Border Name="Border" Padding="2" SnapsToDevicePixels="true" Cursor="Hand" >
                                                        <ContentPresenter />
                                                    </Border>
                                                    <ControlTemplate.Triggers>
                                                        <Trigger Property="IsSelected" Value="true">
                                                            <Setter TargetName="Border" Property="Background" Value="Transparent"/>
                                                        </Trigger>
                                                        <Trigger Property="IsEnabled" Value="false">
                                                            <Setter Property="Foreground" Value="{StaticResource Dark2}"/>
                                                        </Trigger>
                                                        <Trigger Property="IsMouseOver" Value="true">
                                                            <Setter TargetName="Border" Property="Background" Value="Transparent" />
                                                        </Trigger>

                                                    </ControlTemplate.Triggers>
                                                </ControlTemplate>
                                            </Setter.Value>
                                        </Setter>
                                    </Style>
                                </ListBox.Resources>
                            </ListBox>


                        </Grid>
                    </Border>
                </Grid>
            </TabItem>

            <TabItem Header="BÖCKER" Style="{StaticResource BookTabItem}">
                <Grid x:Name="grdBooks" Background="{StaticResource BG1}">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="40" />
                        <RowDefinition Height="1" />
                        <RowDefinition Height="450*"/>
                        <RowDefinition Height="150"/>
                    </Grid.RowDefinitions>

                    <Grid VerticalAlignment="Top" Height="40">
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="100"/>
                            <ColumnDefinition Width="300" SharedSizeGroup="grpFriendlyName" />
                            <ColumnDefinition Width="100" SharedSizeGroup="grpPeriod" />
                            <ColumnDefinition Width="250" SharedSizeGroup="grpAuthor" />
                        </Grid.ColumnDefinitions>
                        <TextBlock Text="Bok" Foreground="{StaticResource Light1}" Grid.Column="1" Margin="5,5" VerticalAlignment="Bottom"/>
                        <TextBlock Text="Period" Foreground="{StaticResource Light1}" Grid.Column="2" Margin="5,5" VerticalAlignment="Bottom" />
                        <TextBlock Text="Inskrivet av" Foreground="{StaticResource Light1}" Grid.Column="3" Margin="5,5" VerticalAlignment="Bottom" />
                    </Grid>

                    <Grid Grid.Row="1" Background="{DynamicResource DarkColor1}" />

                    <ListBox Grid.Row="2" x:Name="lstBooks" HorizontalAlignment="Stretch" VerticalAlignment="Top" ItemsSource="{Binding Path=CurrBooks}"
                             Height="Auto" ItemTemplate="{StaticResource BooksDataTemplate}" Margin="10,10,0,0" MouseDoubleClick="lstBooks_MouseDoubleClick"
                             Background="{DynamicResource BG1}" Foreground="White" BorderBrush="Transparent" />

                    <Grid Grid.Row="3">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50" />
                            <RowDefinition Height="20" />
                            <RowDefinition Height="20" />
                            <RowDefinition Height="20" />
                            <RowDefinition Height="20" />
                            <RowDefinition Height="20" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="150" />
                            <ColumnDefinition />
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <TextBlock Height="23" HorizontalAlignment="Right" Text="Book name:" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10" />
                        <StackPanel Grid.Column="1" HorizontalAlignment="Left" Orientation="Horizontal" >
                            <TextBlock Height="23"
                                   Text="{Binding ElementName=lstBooks, Path=SelectedItem.FriendlyName}" VerticalAlignment="Bottom" 
                                   Style="{StaticResource StdLabels}" Margin="10" FontWeight="Light" FontSize="18" TextTrimming="WordEllipsis" 
                                   Foreground="{DynamicResource Light1}"/>
                            <Button Name="bViewBook" Content="Gå till Bok" Width="100" Height="25" Click="bViewBook_Click" HorizontalAlignment="Left" VerticalAlignment="Center" Margin="10,0"/>
                        </StackPanel>


                        <TextBlock Height="23" Grid.Row="1" HorizontalAlignment="Right" Text="Period:" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10,0" />
                        <TextBlock Height="23" Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" TextTrimming="WordEllipsis" Foreground="{DynamicResource Light1}" 
                                   Text="{Binding ElementName=lstBooks, Path=SelectedItem.Period}" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10,0" />

                        <TextBlock Height="23" Grid.Row="2" HorizontalAlignment="Right" Text="Author:" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}"
                                   Margin="10,0" />
                        <TextBlock Height="23" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" TextTrimming="WordEllipsis" Foreground="{DynamicResource Light1}" 
                                   Text="{Binding ElementName=lstBooks, Path=SelectedItem.Author}" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10,0" />

                        <TextBlock Height="23" Grid.Row="3" HorizontalAlignment="Right" Text="Källa:" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}"
                                   Margin="10,0" />
                        <TextBlock Height="23" Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" TextTrimming="WordEllipsis" Foreground="{DynamicResource Light1}" 
                                   Text="{Binding ElementName=lstBooks, Path=SelectedItem.Source}" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10,0" />

                        <TextBlock Height="23" Grid.Row="4" HorizontalAlignment="Right" Text="Filnamn:" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10,0" />
                        <TextBlock Height="23" Grid.Row="4" Grid.Column="1" HorizontalAlignment="Left" TextTrimming="WordEllipsis" Foreground="{DynamicResource Light1}" 
                                   Text="{Binding ElementName=lstBooks, Path=SelectedItem.FileName}" VerticalAlignment="Bottom" Style="{StaticResource StdLabels}" Margin="10,0" />

                        <WrapPanel Grid.Column="2" Grid.Row="0" HorizontalAlignment="Right" Orientation="Vertical" VerticalAlignment="Top" Margin="10,5">
                            <Button Name="bAddBook" Width="100" Height="25" Style="{StaticResource AddButton}" Click="bAddBook_Click" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="10,0" />

                        </WrapPanel>
                    </Grid>
                </Grid>
            </TabItem>

            <TabItem Header="INSTÄLLNINGAR" Style="{StaticResource SettingTabItem}">
                <Grid>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="200" />
                        <ColumnDefinition />
                    </Grid.ColumnDefinitions>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="50" />
                        <RowDefinition Height="30" />
                        <RowDefinition Height="30" />
                        <RowDefinition Height="30" />
                        <RowDefinition Height="50" />
                    </Grid.RowDefinitions>

                    <CheckBox IsChecked="{Binding Path=DownloadBooks, Mode=TwoWay}" Grid.Column="1" Grid.Row="1">Download books</CheckBox>
                    <TextBlock Text="Hämta böcker till:" Grid.Column="0" Grid.Row="2" HorizontalAlignment="Right" />
                    <TextBox Grid.Column="1" Grid.Row="2" Margin="10,0" Text="{Binding Path=BookDownloadPath, Mode=TwoWay}" />

                </Grid>
            </TabItem>

        </TabControl>

        <Grid x:Name="grdDead" Background="{StaticResource BG1}" Visibility="Collapsed">

            <Grid.RowDefinitions>
                <RowDefinition Height="70" />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <Button x:Name="bBackFromDeathBook" Content="Tillbaka" Width="100" Height="25" Margin="20,0" Click="bBackFromDeathBook_Click" HorizontalAlignment="Left" />
            <TextBlock Grid.Row="0" Text="Dödsbok" FontSize="28" Margin="150,0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" />

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="20,0" VerticalAlignment="Center">
                <TextBlock Text="FILTER:" Foreground="White" VerticalAlignment="Center" FontSize="16" />
                <TextBox Width="200" Name="txtDeathFilter" Margin="6,0,0,0" TextChanged="txtDeathFilter_TextChanged" />
            </StackPanel>

            <ListView Grid.Row="1" Name="lvDeadBook" ItemsSource="{Binding Path=TheDead}" Foreground="White" 
                      Background="{DynamicResource BG1}" BorderBrush="Transparent">
                <ListView.View>
                    <GridView >
                        <GridViewColumn DisplayMemberBinding="{Binding Path=RowID}" Header="Löpnr." />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=DeadDate}" Header="Död" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=BurialDate}" Header="Begravd" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Title}" Header="Titel" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=FirstName}" Header="Förnamn" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=SurName}" Header="Efternamn" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=DeadReason}" Header="Orsak" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=DeadAge}" Header="Ålder" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Address}" Header="Ort" />

                    </GridView>
                </ListView.View>
            </ListView>

            <ListBox Visibility="Collapsed" Grid.Row="1" Name="lstDeadBook" ItemsSource="{Binding Path=TheDead}" ItemTemplate="{StaticResource DeathBookTemplate}" 
                     SelectionChanged="lstDeadBook_SelectionChanged" Background="{StaticResource BG1}" Foreground="DarkGray">

            </ListBox>
            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60*" />
                    <ColumnDefinition Width="153*" />
                    <ColumnDefinition Width="179*" />
                    <ColumnDefinition Width="180*" />
                    <ColumnDefinition Width="290*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="26" />
                    <RowDefinition Height="25" />
                    <RowDefinition Height="26" />
                    <RowDefinition Height="59*" />
                </Grid.RowDefinitions>
                <TextBlock HorizontalAlignment="Left" Name="textBlock1" Text="Pos" VerticalAlignment="Bottom" Margin="6,0,0,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Column="0" Grid.Row="1" Height="23" HorizontalAlignment="Center" Margin="0,3,3,0" Name="textBox1" VerticalAlignment="Top" Text="{Binding Path=CurItem.RowID}" Foreground="White" FontSize="16" />

                <TextBlock Grid.Row="0" Grid.Column="1" Text="Dödsdatum" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="2" Text="Begravning" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="3" Text="Förnamn" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="4" Text="Efternamn" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />

                <TextBox Grid.Row="1" Grid.Column="1" Width="80" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.DeadDate}" />
                <TextBox Grid.Row="1" Grid.Column="2" Width="100" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.BurialDate}" />
                <TextBox Grid.Row="1" Grid.Column="3" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.FirstName}" />
                <TextBox Grid.Row="1" Grid.Column="4" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.SurName}" />

                <TextBlock Grid.Row="2" Grid.Column="1" Text="Kön" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="2" Text="Titel" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="3" Text="Adress" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="4" Text="Död ålder" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />

                <TextBox Grid.Row="3" Grid.Column="1" Width="80" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.Gender}" />
                <TextBox Grid.Row="3" Grid.Column="2" Width="100" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.Title}" />
                <TextBox Grid.Row="3" Grid.Column="3" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.Address}" />
                <TextBox Grid.Row="3" Grid.Column="4" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurItem.DeadAge}" />


                <Button Content="Add" Grid.Column="4" Grid.Row="4" Height="23" HorizontalAlignment="Right" Margin="0,0,6,6" Name="bAdd" VerticalAlignment="Bottom" Width="75" Click="bAdd_Click" />
            </Grid>
        </Grid>

        <Grid x:Name="grdBorn" Background="{StaticResource BG1}" Visibility="Collapsed">

            <Grid.RowDefinitions>
                <RowDefinition Height="70" />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <StackPanel Orientation="Horizontal" Grid.Row="0">

                <Button x:Name="bBackFromBirthBook" HorizontalAlignment="Left" Margin="20,0,0,0"  Content="Tillbaka" Width="100" Height="25" Click="bBackFromBirthBook_Click" />
                <TextBlock Text="Födelsebok" FontSize="28" Margin="20,0,0,0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" />
                <TextBlock Text="{Binding Path=CurBirthBook.Area}" Margin="20,0,0,0" FontSize="28" 
                           Foreground="{StaticResource Light1}" FontWeight="Light" />
            </StackPanel>

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="20,0" VerticalAlignment="Center">
                <TextBlock Text="FILTER:" Foreground="White" VerticalAlignment="Center" FontSize="16" />
                <TextBox Width="200" Name="txtBirthFilter" Margin="6,0,0,0" TextChanged="txtBirthFilter_TextChanged" />
            </StackPanel>

            <ListBox Grid.Row="1" Name="lstBirthBook" ItemsSource="{Binding Path=TheBorn}" ItemTemplate="{StaticResource BirthBookTemplate}" 
                     SelectionChanged="lstBirthBook_SelectionChanged" Background="{DynamicResource BG1}" BorderBrush="Transparent" 
                     Foreground="White">

            </ListBox>
            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60*" />
                    <ColumnDefinition Width="153*" />
                    <ColumnDefinition Width="179*" />
                    <ColumnDefinition Width="180*" />
                    <ColumnDefinition Width="290*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="26" />
                    <RowDefinition Height="25" />
                    <RowDefinition Height="26" />
                    <RowDefinition Height="59*" />
                </Grid.RowDefinitions>



                <TextBlock HorizontalAlignment="Left" Text="Pos" VerticalAlignment="Bottom" Margin="6,0,0,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Column="0" Grid.Row="1" Height="23" HorizontalAlignment="Center" Margin="0,3,3,0" VerticalAlignment="Top" Text="{Binding Path=CurBirthBook.RowID}" Foreground="White" FontSize="16" />

                <TextBlock Grid.Row="0" Grid.Column="1" Text="Födelsedatum" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="2" Text="Dopdag" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="3" Text="Förnamn" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="4" Text="Efternamn" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />

                <TextBox Grid.Row="1" Grid.Column="1" Width="80" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.BirthDate}" />
                <TextBox Grid.Row="1" Grid.Column="2" Width="100" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.ChristeningDate}" />
                <TextBox Grid.Row="1" Grid.Column="3" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.FirstName}" />
                <TextBox Grid.Row="1" Grid.Column="4" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.SurName}" />

                <TextBlock Grid.Row="2" Grid.Column="1" Text="Kön" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="2" Text="Fader Titel" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="3" Text="Adress" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="4" Text="error" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />

                <TextBox Grid.Row="3" Grid.Column="1" Width="80" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.Gender}" />
                <TextBox Grid.Row="3" Grid.Column="2" Width="100" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.FatherTitle}" />
                <TextBox Grid.Row="3" Grid.Column="3" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.Address}" />
                <TextBox Grid.Row="3" Grid.Column="4" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurBirthBook.MotherAge}" />



            </Grid>
        </Grid>

        <Grid Name="grdMarriage" Background="{StaticResource BG1}" Visibility="Collapsed">
            <Grid.RowDefinitions>
                <RowDefinition Height="70" />
                <RowDefinition />
                <RowDefinition />
            </Grid.RowDefinitions>

            <Button x:Name="bBackFromMarriageBook" Content="Tillbaka" Width="100" Height="25" Margin="20,0" Click="bBackFromMarriageBook_Click" HorizontalAlignment="Left" />
            <TextBlock Grid.Row="0" Text="Vigselbok" FontSize="28" Margin="150,0" HorizontalAlignment="Left" VerticalAlignment="Center" Foreground="White" />

            <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="20,0" VerticalAlignment="Center">
                <TextBlock Text="FILTER:" Foreground="White" VerticalAlignment="Center" FontSize="16" />
                <TextBox Width="200" Name="txtMarriageFilter" Margin="6,0,0,0" TextChanged="txtMarriageFilter_TextChanged" />
            </StackPanel>

            <ListView Grid.Row="1" Name="lvMarriageBook" ItemsSource="{Binding Path=TheMarriaged}" Foreground="White" 
                      Background="{DynamicResource BG1}" BorderBrush="Transparent" SelectionChanged="lvMarriageBook_SelectionChanged">
                <ListView.View>
                    <GridView >
                        <GridViewColumn DisplayMemberBinding="{Binding Path=RowID}" Header="Löpnr." />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=Banns}" Header="Lysning" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=MarriageDate}" Header="Vigsel" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=MaleTitle}" Header="Titel man" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=MaleFirstName}" Header="Förnamn m" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=MaleSurName}" Header="Efternamn m" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=FemaleTitle}" Header="Title kvinna" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=FemaleFirstName}" Header="Förnamn k" />
                        <GridViewColumn DisplayMemberBinding="{Binding Path=FemaleSurName}" Header="Efternamn k" />

                    </GridView>
                </ListView.View>
            </ListView>

            <Grid Grid.Row="2">
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="60*" />
                    <ColumnDefinition Width="153*" />
                    <ColumnDefinition Width="179*" />
                    <ColumnDefinition Width="180*" />
                    <ColumnDefinition Width="290*" />
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="30" />
                    <RowDefinition Height="26" />
                    <RowDefinition Height="25" />
                    <RowDefinition Height="26" />
                    <RowDefinition Height="59*" />
                </Grid.RowDefinitions>
                <TextBlock HorizontalAlignment="Left" Text="Pos" VerticalAlignment="Bottom" Margin="6,0,0,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Column="0" Grid.Row="1" Height="23" HorizontalAlignment="Center" Margin="0,3,3,0" VerticalAlignment="Top" Text="{Binding Path=CurMItem.RowID}" Foreground="White" FontSize="16" />

                <TextBlock Grid.Row="0" Grid.Column="1" Text="Lysning" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="2" Text="Vigsel" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="3" Text="Förnamn man" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="0" Grid.Column="4" Text="Efternamn man" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />

                <TextBox Grid.Row="1" Grid.Column="1" Width="80" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.Banns}" />
                <TextBox Grid.Row="1" Grid.Column="2" Width="100" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.MarriageDate}" />
                <TextBox Grid.Row="1" Grid.Column="3" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.MaleFirstName}" />
                <TextBox Grid.Row="1" Grid.Column="4" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.MaleSurName}" />

                <TextBlock Grid.Row="2" Grid.Column="1" Text="Förnamn kvinna" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="2" Text="Efternamn kvinna" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="3" Text="Ort kvinna" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />
                <TextBlock Grid.Row="2" Grid.Column="4" Text="Ort man" VerticalAlignment="Bottom" Margin="6,0" Style="{StaticResource StdLabels}" />

                <TextBox Grid.Row="3" Grid.Column="1" Width="80" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.FemaleFirstName}" />
                <TextBox Grid.Row="3" Grid.Column="2" Width="100" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.FemaleSurName}" />
                <TextBox Grid.Row="3" Grid.Column="3" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.FemaleAddress}" />
                <TextBox Grid.Row="3" Grid.Column="4" Width="150" Height="25" HorizontalAlignment="Left" Text="{Binding Path=CurMItem.MaleAddress}" />


                <Button Content="Add" Grid.Column="4" Grid.Row="4" Height="23" HorizontalAlignment="Right" Margin="0,0,6,6" Name="bAddMarriage" VerticalAlignment="Bottom" Width="75" Click="bAddMarriage_Click" />
            </Grid>
        </Grid>

        <Grid Name="grdBook" Visibility="Collapsed" Grid.Row="0" Grid.RowSpan="2">
            <Frame Name="frmBooks" NavigationUIVisibility="Hidden" HorizontalAlignment="Stretch" VerticalAlignment="Stretch">

            </Frame>
        </Grid>

    </Grid>
</Window>
